import { Moment } from "moment";
import { BudgetItem } from "../../interface/budgetData";
import { FetchBudgetListDataURL } from "../../RequestURL";

export const FetchBudgetListDataApi = async (dateRange: Moment[]): Promise<BudgetItem[]> =>
{
    let res = await fetch(FetchBudgetListDataURL, {
        method: "POST",
        headers: {
            'content-type': 'application/json;charset=utf-8'
        },
        body: JSON.stringify([dateRange[0].format("YYYY-MM-DD"), dateRange[1].format('YYYY-MM-DD')])
    });
    return await res.json();
};
